package icu.zqyhdm.blog.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import icu.zqyhdm.blog.entity.Article;
import icu.zqyhdm.blog.vo.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description
 * @Author lifu
 * @Date 2021/6/22 21:17
 */
public interface ArticleService extends IService<Article> {

    //根据名称对文章进行模糊查询
    Page<ArticleListVo> selectPageByName(Integer current, Integer limit, ArticleQueryVo articleQueryVo);

    //根据id对文章进行精确查询
    Page<ArticleListVo> selectPageById(Integer current, Integer limit, ArticleQueryIdVo articleQueryIdVo);

    //查询文章详情
    ArticleDetailVo getArticleById(Integer id);

    // 从redis查浏览数、点赞数动态数据
    ArticleDetailVo getDynamicData(ArticleDetailVo articleDetailVo);

    //保存文章
    Integer saveArticle(String token, ArticleUploadVo articleUploadVo);

    //修改文章
    Integer updateArticle(String token, ArticleUploadVo articleUploadVo);

    //删除文章
    void deleteArticle(String token, Integer id);

    //更新文章浏览量
    void updateArticleViews(HttpServletRequest request, Integer id);

    //点赞
    void likeArticle(String token,Integer id);

    //热点文章，根据浏览量查
    Page<ArticleHotVo> selectHotArticle(Integer current, Integer limit);

    //日期数量归档
    Page<CreateTimeVo> selectCreateTimeList(Integer current, Integer limit);

    //上传文件到阿里云oss
    String upload(String token, MultipartFile multipartFile,Integer articleId);

    //日期归档
    Page<ArticleInfoVo> getArchiveList(Integer current, Integer limit);
}
